package com.second.ssyt_test.assist.servlet;

import java.io.IOException;
import java.util.TimerTask;
/** 
 * 执行内容 
 * @author admin_Hzw 
 * 
 */  
public class Task extends TimerTask {  
    public void run() {
		backups();
    }     
    /**
	 * 数据备份
	 * @param request
	 * @param response
	 */
    private void backups() {
    	String user = "root"; // 数据库帐号
    	String password = "root"; // 登陆密码
    	String database = "yec"; // 需要备份的数据库名
    	String filepath = "e:\\mysqlbackup\\stest.sql"; // 备份的路径地址

    	String stmt1 = "mysqldump " + database + " -u " + user + " -p"
    	+ password + " --result-file=" + filepath;
    	try {
    	Runtime.getRuntime().exec(stmt1);
    	}
    	catch (IOException e) {
    	e.printStackTrace();
    	}


	}
}